package logic.table;

import android.provider.BaseColumns;

import logic.constants.DefaultConsts;
import logic.util.logutil.LogUtil;


/**
 * 用户表
 * 
 * @author 刘宾
 * @date 2014年8月11日 上午10:42:25
 */
public class UserTable
{
	public static final int    LOGIN_STATUS_LOGOUT = 0;
	public static final int    LOGIN_STATUS_LOGIN  = 1;
	
	public static final String table               = "lq_user";
	
	public final class UserColumns
	        implements
	        BaseColumns
	{
		public final static String COLUMN_ID              = "id";
		public final static String COLUMN_SOUND_ID        = "soundId";
		public final static String COLUMN_ACCOUNT         = "account";
		public final static String COLUMN_PASSWORD        = "password";
		public final static String COLUMN_IMSI            = "imsi";
		public final static String COLUMN_HEAD_URL        = "headImage";
		public final static String COLUMN_NICK_NAME       = "nickName";
		public final static String COLUMN_SEX             = "sex";
		public final static String COLUMN_BIRTHDAY        = "birthday";
		public final static String COLUMN_KEY             = "key";
		public final static String COLUMN_LOGINTIME       = "logintime";
		public final static String COLUMN_IS_KEEEP_PWD    = "isKeepPwd";
		public final static String COLUMN_LOGIN_STATUS    = "loginStatus";
		public final static String COLUMN_SERVICE_TIME    = "closeTime";
		public final static String COLUMN_NETEASE_ACCOUNT = "imAccount";
		public final static String COLUMN_NETEASE_TOKEN   = "imToken";
		public final static String STAFFID                = "staffId";
		
		public final static String COLUMN_HOMETOWN   = "homeTown";
		public final static String COLUMN_LIVENOW   = "liveNow";
		public final static String COLUMN_INTEREST   = "interest";
		public final static String COLUMN_JOB   = "job";
		public final static String COLUMN_DESC   = "desc";
	}
	
	public static String getCreateTableSQL() {
		StringBuilder sb = new StringBuilder();
		sb.append("CREATE TABLE IF NOT EXISTS " + table + "(");
		
		sb.append(UserColumns.COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT,");
		sb.append(UserColumns.COLUMN_SOUND_ID + " TEXT,");
		sb.append(UserColumns.COLUMN_ACCOUNT + " TEXT, ");
		sb.append(UserColumns.COLUMN_PASSWORD + " TEXT,");
		sb.append(UserColumns.COLUMN_IMSI + " TEXT,");
		sb.append(UserColumns.COLUMN_HEAD_URL + " TEXT,");
		sb.append(UserColumns.COLUMN_NICK_NAME + " TEXT,");
		sb.append(UserColumns.COLUMN_SEX + " TEXT,");
		sb.append(UserColumns.COLUMN_BIRTHDAY + " TEXT,");
		sb.append(UserColumns.COLUMN_KEY + " TEXT,");
		sb.append(UserColumns.COLUMN_LOGINTIME + " BIGINT,");
		sb.append(UserColumns.COLUMN_IS_KEEEP_PWD + " INTEGER DEFAULT 1 ,");
		sb.append(UserColumns.COLUMN_LOGIN_STATUS + " INTEGER DEFAULT 0 ,");
		sb.append(UserColumns.COLUMN_SERVICE_TIME + " BIGINT ,");
		sb.append(UserColumns.COLUMN_NETEASE_ACCOUNT + " TEXT ,");
		sb.append(UserColumns.COLUMN_NETEASE_TOKEN + " TEXT,");
		sb.append(UserColumns.STAFFID + " TEXT,");
		
		sb.append(UserColumns.COLUMN_HOMETOWN + " TEXT,");
		sb.append(UserColumns.COLUMN_LIVENOW + " TEXT,");
		sb.append(UserColumns.COLUMN_INTEREST + " TEXT,");
		sb.append(UserColumns.COLUMN_JOB + " TEXT,");
		sb.append(UserColumns.COLUMN_DESC + " TEXT");
		sb.append(");");
		LogUtil.d(DefaultConsts.TAG, table + ":" + sb.toString());
		return sb.toString();
	}
}
